
#include <iostream>
#include <string>
#include <vector>
using namespace std;

#include "string.h"

void test_string1()
{
	bit::string s;
	std::cout << s.c_str() << std::endl;
	bit::string s1("hello,world");
	std::cout << s1.c_str() << std::endl;
	bit::string s2(s1);
	std::cout << s2.c_str() << std::endl;

	bit::string s3("America,this is a monkey");
	std::cout << s3.c_str() << std::endl;
// 	s3 = s2;
// 	std::cout << s3.c_str() << std::endl;
	s2 = s3;
	std::cout << s2.c_str() << std::endl;

	std::cout << s2[10] << std::endl;
	std::cout << s2.size() << std::endl;
	for (int i = 0; i < s2.size(); i++)
	{
		std::cout << s2[i] << " ";
	}
	std::cout << std::endl;
}

void test_string2()
{
	bit::string s1("hello world");
	bit::string s2(s1);
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;

	s1[0] = 'x';

	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
}

void test_string3()
{
	bit::string s1("hello world");
	bit::string s2(s1);
	bit::string s3("111111111");
	s1 = s3;

	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	cout << s3.c_str() << endl;

	s1 = s1;

	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	cout << s3.c_str() << endl;
}

void test_string4()
{
	bit::string s1("hello world");
	cout << s1.c_str() << endl;

	bit::string s2;
	cout << s2.c_str() << endl;
}

void test_string5()
{
	bit::string s1("hello world");
	cout << s1.c_str() << endl;
	s1.push_back('1');
	s1.push_back('1');

	cout << s1.c_str() << endl;
	s1 += '2';
	s1 += '3';
	s1 += '4';
	cout << s1.c_str() << endl;

	s1 += "bite12";
	cout << s1.size() << endl;
	cout << s1.capacity() << endl;
	s1 += "3";
	cout << s1.c_str() << endl;

	bit::string s2;
	s2.reserve(20);
	cout << s2.capacity() << endl;
	s2 += "hello";
	cout << s2.capacity() << endl;
	s2 += "Amercia,this is a big pag!what is this";
	cout << s2.capacity() << " " << s2.c_str() << endl;

	bit::string s3("hello world");
	s3.reserve(15);
	//s3.resize(21, 'x');
	s3.resize(14, 'x');
	s3.resize(5);

	s1 < s2;

}

int main()
{
	//test_string1();
	//test_string2();
	//test_string3();
	//test_string4();
	test_string5();

	return 0;
}